{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e3949d5f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "from urllib import parse\n",
    "import os\n",
    "import re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "975e86cb",
   "metadata": {},
   "outputs": [],
   "source": [
    "usr_name = \"1152776388@qq.com\"\n",
    "pwd = \"22446688a\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "92dc9cd6",
   "metadata": {},
   "outputs": [],
   "source": [
    "qs = f\"action=user_login&username={usr_name}&password={pwd}\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "ff403260",
   "metadata": {},
   "outputs": [],
   "source": [
    "login_url = \"https://www.huotuji.fun/wp-admin/admin-ajax.php\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "496ebe01",
   "metadata": {},
   "outputs": [],
   "source": [
    "url = \"https://www.huotuji.fun/\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "339af295",
   "metadata": {},
   "outputs": [],
   "source": [
    "param = parse.parse_qs(qs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "9b9fd047",
   "metadata": {},
   "outputs": [],
   "source": [
    "for k,v in param.items():\n",
    "    param[k] = v[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "1261e45e",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/miniconda3/lib/python3.8/site-packages/urllib3/connectionpool.py:1056: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.huotuji.fun'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n",
      "  warnings.warn(\n"
     ]
    }
   ],
   "source": [
    "res = requests.post(login_url, data=param, verify=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "f723f8c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "cookie = res.cookies"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
